package com.darren.archive.controller;

import com.darren.framework.bean.ResponseBean;
import com.darren.framework.controller.BaseController;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiImplicitParam;
import io.swagger.annotations.ApiImplicitParams;
import io.swagger.annotations.ApiOperation;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RestController;
import redis.clients.jedis.Jedis;

@Api(value = "redis测试",tags = "redis测试接口",description = "redis测试接口")
@RestController
public class RedisTestController extends BaseController {


    @ApiImplicitParams({
            @ApiImplicitParam(name = "key",value = "redis Key，必填",required = true,paramType = "path",dataType = "String"),
            @ApiImplicitParam(name = "value",value = "redis value，必填",required = true,paramType = "path",dataType = "String")
    })
    @ApiOperation(value = "测试redis的set", notes = "测试redis的set")
    @PostMapping("/redis/pool/set/{key}/{value}")
    public ResponseBean testRedisPoolSet(@PathVariable(name = "key") String key,
                                         @PathVariable(name = "value") String value) {
        Jedis jedis = jedisPool.getResource();
        jedis.set(key, value);
        return ResponseBean.isOk(SUCCESS);
    }


}
